# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=gawk
pkgver=5.0.1
pkgrel=1
pkgdesc="GNU version of awk"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/gawk/"
license=('GPL')
groups=('base' 'base-devel')
depends=('sh' 'mpfr' 'libintl' 'libreadline')
makedepends=('gettext-devel' 'mpfr-devel' 'libreadline-devel')
provides=('awk')
install=gawk.install
source=(https://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.sig}
        gawk-4.2.1-msysize.patch)
sha256sums=('625bf3718e25a84dc4486135d5cb5388174682362c70107fd13f21572f5603bb'
            'SKIP'
            '303a1fa02fb3e5bf075319d6e9982986d37e156be630d0141a1148cd803c67c4')
validpgpkeys=('D1967C63788713177D861ED7DF597815937EC0D2')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/gawk-4.2.1-msysize.patch
  autoreconf -fiv
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --build=${CHOST} \
              --prefix=/usr \
              --libexecdir=/usr/lib \
              --without-libiconv-prefix \
              --without-libintl-prefix \
              --without-libsigsegv

  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
